﻿using System;
using System.Windows;
using Dsl.Ped.Framework.Common;

namespace Dsl.Ped.Framework.Projections.ConstantProjections
{
    /// <summary>
    /// Hint for the creation of constant-based projections
    /// </summary>
    /// <typeparam name="T">Type of the projection (like Label, TextBox, etc.)</typeparam>
    public class ConstantProjectionHint<T> : ProjectionHint<T>, IConstantProjectionHint<T>
        where T : FrameworkElement, new()
    {
        #region Members

        /// <summary>
        /// Gets the type representing the projection
        /// </summary>
        public Type ProjectionType 
        { 
            get { return typeof(T); } 
        }

        /// <summary>
        /// Gets the <see cref="DependencyProperty"/> which can be bound into this projection
        /// </summary>
        public DependencyProperty ValueProperty { get; private set; }

        #endregion

        /// <summary>
        /// Initializes a new instance of the <see cref="ConstantProjectionHint{T}"/> class.
        /// </summary>
        /// <param name="valueProperty">The bindable value property</param>
        /// <param name="defaultConfiguration">The default configuration applied on the projection instance</param>
        /// <param name="customConfiguration">The custom configuration applied after the <see cref="defaultConfiguration"/></param>
        public ConstantProjectionHint(DependencyProperty valueProperty, Action<T, Type> defaultConfiguration, Action<T> customConfiguration)
            : base(defaultConfiguration, customConfiguration)
        {
            this.ValueProperty = valueProperty;
        }
    }
}
